import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '车牌号',
    align: 'center',
    dataIndex: 'carNumber',
  },
  {
    title: '泊位号',
    align: 'center',
    dataIndex: 'berthNumber',
  },
  {
    title: '计费金额',
    align: 'center',
    dataIndex: 'oldAmount',
  },
  {
    title: '实际金额',
    align: 'center',
    dataIndex: 'actualAmount',
  },
  {
    title: '地址',
    align: 'center',
    dataIndex: 'address',
  },
  {
    title: '开始时间',
    align: 'center',
    dataIndex: 'startTime',
  },
  {
    title: '结束时间',
    align: 'center',
    dataIndex: 'endTime',
  },
  {
    title: '停车时长',
    align: 'center',
    dataIndex: 'durationParking',
  },
  {
    title: '小时单价',
    align: 'center',
    dataIndex: 'price',
  },
  {
    title: '超1小时单价',
    align: 'center',
    dataIndex: 'overOneHourprice',
  },
  {
    title: '出场状态',
    align: 'center',
    dataIndex: 'getOutStatus_dictText',
  },
  {
    title: '付款状态',
    align: 'center',
    dataIndex: 'payStatus_dictText',
  },
  {
    title: '实付金额',
    align: 'center',
    dataIndex: 'payamount',
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '车牌号',
    field: 'carNumber',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: '泊位号',
    field: 'berthNumber',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: '出场状态',
    field: 'getOutStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'get_out_status',
    },
    //colProps: {span: 6},
  },
  {
    label: '付款状态',
    field: 'payStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'pay_status',
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '车牌号',
    field: 'carNumber',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入车牌号!' }];
    },
  },
  {
    label: '泊位号',
    field: 'berthNumber',
    component: 'Input',
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入泊位号!' }];
    },
  },

  {
    label: '地址',
    field: 'address',
    component: 'InputTextArea',
  },
  {
    label: '开始时间',
    field: 'startTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
    dynamicRules: ({ model, schema }) => {
      return [{ required: true, message: '请输入开始时间!' }];
    },
  },
  {
    label: '结束时间',
    field: 'endTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '停车时长',
    field: 'durationParking',
    component: 'Input',
  },
  {
    label: '小时单价',
    field: 'price',
    component: 'Input',
  },
  {
    label: '计费金额',
    field: 'oldAmount',
    component: 'InputNumber',
  },
  {
    label: '实际金额',
    field: 'actualAmount',
    component: 'InputNumber',
  },
  {
    label: '出场状态',
    field: 'getOutStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'get_out_status',
    },
  },
  {
    label: '付款状态',
    field: 'payStatus',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'pay_status',
    },
  },
  {
    label: '实付金额',
    field: 'payamount',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
